package fi.roose.uidesignia.data;

import java.util.HashMap;
import java.util.Map;

/**
 * Encapsulates one made suggestion with votes
 *
 */
public class Suggestion {
	public final Restaurant restaurant;
	public final String evangelist;
	public final String message;
	private final Map<String, Integer> mVotes = new HashMap<String, Integer>();
	
	public Suggestion(Restaurant restaurant, String message, String evangelist){
		this.restaurant = restaurant;
		this.evangelist = evangelist;
		this.message = message;
	}
	
	public void setVote(Integer vote){
		mVotes.put(DataModel.getVirtaulName(), vote);
	}
	
	public int getScore(){
		int sum = 0;
		for(Integer i : mVotes.values()){
			sum += i;
		}
		return sum;
	}
	
	public int getNumberOfDeclines(){
		int instances = 0;
		for(Integer i : mVotes.values()){
			if(i < 1){
				instances++;
			}
		}
		return instances;
	}

	public Integer getMyVote() {
		return mVotes.get(DataModel.getVirtaulName());
	}
	
}
